Introduction

'X'

Version 1.51 - (C)1999-2002 Jonathan Bennett

(Email: support@hiddensoft.com)

AutoIt Homepage

AutoIt is a simple tool that can simulate key presses, mouse movements and window commands (maximize, minimize, wait for, etc.) in order to automate any windows based task (or even windowed DOS tasks).

AutoItX is an ActiveX control version of AutoIt. It allows you to perform the following types of functions:

  • Sending keystrokes and mouse clicks (all characters, keyboard layout independent).
  • Window functions (e.g. minimizing, hiding, restoring, waiting for, activating (even under Win98/NT2000)).
  • Sleep (for those with WSH 1.0 :) )
  • INI file reading and writing.
  • Simple clipboard (text) commands.
  • Shutdown and reboot commands (including a forced reboot that works under both 9x and NT).
  • Blocking input under Windows NT4 SP6 and 2000.

Best of all, its small and FREE!

All examples are in WSH-VBScript, although it should work fine from any language capable of using ActiveX components.


Intended Use

AutoItX is intended to be used to conjunction with other scripting languages such as WSH, VBScript, etc. To "fill in the gaps" of the built in automation routines. If you don't want to use another scripting language, you could try the full version of AutoIt which has it's own .exe and script processing functions.


License

Author : Jonathan Bennett
WWW : http://www.hiddensoft.com/AutoIt/
Email : jbennett@hidden.demon.co.uk
________________________________________________________

END-USER LICENSE AGREEMENT FOR THIS SOFTWARE

Important - read carefully:

This End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and the mentioned author of this Software for the software product identified above, which includes computer software and may include associated media, printed materials, and "online" or electronic documentation ("SOFTWARE PRODUCT"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, do not install or use the SOFTWARE PRODUCT.

SOFTWARE PRODUCT LICENSE

The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. The definition of SOFTWARE PRODUCT includes any files generated by the SOFTWARE PRODUCT, such as compiled script files in the form of standalone executables.

1. GRANT OF LICENSE.

This EULA grants you the following rights:

Installation and Use. You may install and use an unlimited number of copies of the SOFTWARE PRODUCT.

Reproduction and Distribution. You may reproduce and distribute an unlimited number of copies of the SOFTWARE PRODUCT; provided that each copy shall be a true and complete copy, including all copyright and trademark notices, and shall be accompanied by a copy of this EULA. Copies of the SOFTWARE PRODUCT may be distributed as a standalone product or included with your own product.

Commercial Use. If the SOFTWARE PRODUCT is to be included in a solution or product that will be sold for profit, you are required to acknowledge in your product documentation and/or help files, that this SOFTWARE PRODUCT was used. You are further required to provide a link to the web homepage specified at the top of this EULA.

2. COPYRIGHT.

All title and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT), the accompanying printed materials, and any copies of the SOFTWARE PRODUCT are owned by the Author of this Software. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material.

MISCELLANEOUS

If you acquired this product in the United Kingdom, this EULA is governed by the laws of the United Kingdom. If this product was acquired outside the United Kingdom, then local law may apply. Should you have any questions concerning this EULA, or if you desire to contact the author of this Software for any reason, please contact him/her at the email address mentioned at the top of this EULA.

LIMITED WARRANTY

NO WARRANTIES.

The Author of this Software expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or noninfringement. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.

NO LIABILITY FOR DAMAGES.

In no event shall the author of this Software be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this product, even if the Author of this Software has been advised of the possibility of such damages.

Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.

[END OF LICENSE]


What does the license mean?

Licenses are particularly hard to follow, so here are my answers to the most frequently asked license questions:

GENERAL

Can I distribute the programs/scripts that use AutoItX. YES.

Can I modify the AutoIt executable/dll or compiled scripts (changing resources, and version information in order to pass off AutoIt as your own program). NO. You are only allowed to change the icon in compiled scripts, and this facility is provided by Aut2Exe.

If you require an alternative license agreement, then email me and make me an offer :)

NON-COMMERCIAL USE

For non-commercial use, a "mention" that you are using AutoIt in your product/solution and a link to the AutoIt homepage would be very much appreciated.

COMMERCIAL USE

You are required to mention that AutoIt was used in your product/solution. You are also required to provide a link to the AutoIt homepage.

Note: Commercial-Use implies that you are selling your solution/product for profit. Using AutoIt within an organisation (for example, internal scripted builds) is not classed as commercial-use.


Running AutoIt

Using AutoItX

AutoItX consists of the following files (if you installed the full AutoIt installation these files will be located in the "Program Files\AutoIt\AutoItX\" directory):

File | Comment
AutoItX.dll | The DLL file
AutoItX.chm | This help file

How you use AutoItX depends on the language/scripting environment you use. If you are reasonably comfortable with the language you are using, you should be able to work it out! :)

AutoItX is an ActiveX control, before use it must be registered on the client machine using "regsvr32.exe". It can then be accessed from the script of your choice (all examples in this archive will use VBScript) (Note, if you installed the full version of AutoIt, the control should already have been registered for you, so this step is not necessary).

To create the AutoItX (in VBScript) object you will need the following (or similar) line of code, "AutoItX.Control" is the class name:

Set oAutoIt = CreateObject("AutoItX.Control")


Window Titles and Window Text

A number of script commands have "Window Title" and "Window Text" as parameters.
"Window Title" is text that appears in the windows title bar.
"Window Text" is any other text on that window, e.g. text on buttons such as "OK" and "Cancel". If you don't wish to specify window text, you must use a blank string instead, i.e. ""

Having "Window Text" allows you to distinguish between multiple windows that have the same title.

Neither the title nor text needs to be completely specified.
i.e. "Untitled - No" will match a window with the title "Untitled - Notepad".
See the text on the SetTitleMatchMode command for additions to this.

Hint: Use the "/reveal" mode of the full AutoIt product to see what text is present on a window.
N.B. Windows titles and text are CASE SENSITIVE!!!!!


Conventions

Methods and properties are shown as follows (example):

intResult = WinWait(
    strTitle,
    strText,
    [nTimeout]
 )

Strings parameters are denoted by the "str" prefix. Numeric parameters are prefixed with "int". Optional parameters are shown in square brackets: "[optional]".

This means that in the example above that the WinWait method returns a numeric value, and takes two strings, and an optional numeric value as parameters.


Send Command Syntax

The "Send" command syntax is similar to that of ScriptIt and the Visual Basic "SendKeys" command. Characters are sent as written with the exception of the following characters:

'!'
This tells AutoIt to send an ALT keystroke, therefore Send "This is text!a" would send the keys "This is text" and then press "ALT+a".

N.B. Some programs are very choosy about capital letters and ALT keys, i.e. "!A" is different to "!a". The first says ALT+SHIFT+A, the second is ALT+a. If in doubt, use lowercase!

'+'
This tells AutoIt to send a SHIFT keystroke, therefore Send "Hell+o" would send the text "HellO". Send "!+a" would send "ALT+SHIFT+a".

'^'
This tells AutoIt to send a CONTROL keystroke, therefore Send "^!a" would send "CTRL+ALT+a".

N.B. Some programs are very choosy about capital letters and CTRL keys, i.e. "^A" is different to "^a". The first says CTRL+SHIFT+A, the second is CTRL+a. If in doubt, use lowercase!

'#'
The hash is used as a key delimiter to make a line easier to read. i.e. Send "H#e#l#l#o" is the same as Send "Hello".

Certain special keys can be sent and should be enclosed in braces:

N.B. Windows does not allow the simulation of the "CTRL-ALT-DEL" combination!

Send Command | Resulting Keypress
{!} | !
{#} | #
{+} | +
{^} | ^
{{} | {
{}} | }
{SPACE} | SPACE
{ENTER} | ENTER
{ALT} | ALT
{BACKSPACE} or {BS} | BACKSPACE
{DELETE} or {DEL} | DELETE
{UP} | Cursor up
{DOWN} | Cursor down
{LEFT} | Cursor left
{RIGHT} | Cursor right
{HOME} | HOME
{END} | END
{ESCAPE} or {ESC} | ESCAPE
{INSERT} or {INS} | INS
{PGUP} | PGUP
{PGDN} | PGDN
{F1} - {F12} | Function keys
{TAB} | TAB
{PRINTSCREEN} | PRINTSCR
{LWIN} | Left Windows key
{RWIN} | Right Windows key
{NUMLOCK} | NUMLOCK
{CTRLBREAK} | Ctrl+break
{PAUSE} | PAUSE
{CAPSLOCK} | CAPSLOCK
{NUMPAD0} - {NUMPAD 9} | Numpad digits
{NUMPADMULT} | Numpad Multiply
{NUMPADADD} | Numpad Add
{NUMPADSUB} | Numpad Subtract
{NUMPADDIV} | Numpad Divide
{NUMPADDOT} | Numpad period
{APPSKEY} | Windows App key
{ALTDOWN} | Holds the ALT key down until {ALTUP} is sent
{SHIFTDOWN} | Holds the SHIFT key down until {SHIFTUP} is sent
{CTRLDOWN} | Holds the CTRL key down until {CTRLUP} is sent
{LWINDOWN} | Holds the left Windows key down until {LWINUP} is sent
{RWINDOWN} | Holds the right Windows key down until {RWINUP} is sent
{ASC nnnn} | Send the ALT+nnnn key combination

To send the ASCII value A (same as pressing ALT+65 on the numeric keypad)
 Send "{ASC 65}"

Single keys can also be repeated, e.g.
 Send "{DEL 4}" Presses the DEL key 4 times
Send "{S 30}" Sends 30 'S' characters
Send "+{TAB 4}" Presses SHIFT+TAB 4 times


Complete Function List

B

BlockInput

C

ClipGet
ClipPut

D

DetectHiddenText

I

IfWinActive
IfWinExist
IniDelete
IniRead
IniWrite

L

LeftClick
LeftClickDrag

M

MouseGetPosX
MouseGetPosY
MouseMove

R

RightClick
RightClickDrag

S

Send
SetCapslockState
SetKeyDelay
SetStoreCapslockMode
SetTitleMatchMode
SetWinDelay
Shutdown
Sleep

W

WinActivate
WinClose
WinGetActiveTitle
WinHide
WinKill
WinMaximize
WinMinimize
WinMinimizeAll
WinMinimizeAllUndo
WinMove
WinRestore
WinSetTitle
WinShow
WinWait
WinWaitActive
WinWaitClose
WinWaitNotActive


Script Commands

Init

Resets AutoIt to defaults (window delays, key delays, etc.). This function is called automatically when the DLL is loaded.
Init()

Parameters
None

Return value
None.

Remarks
This is called internally when the DLL loads to reset AutoIt to defaults. Depending on how your calling language uses DLLs you may need to call it manually before using other AutoIt functions. If you always call this first before using other AutoIt functions you will be safe.


Shutdown

This function can perform various types of shutdown on all Windows operating systems.
Shutdown(
    intFlag
)

Parameters

intFlag [in] A combination of the flags given in the remarks section.

Return value
None.

Remarks
The value of nFlag can be a combination of the flags below:

Function | Flag
Log off the current user | 0
Shutdown the workstation | 1
Reboot the workstation | 2
Force closing of applications (may lose unsaved work) | 4
Shutdown and power off (if supported) | 8

i.e. To shutdown and reboot, the value of nFlag would be 3.

Example
To shutdown and reboot:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.Shutdown 3


Sleep

This function simply pauses for an amount of time.
Sleep(
    intMilliseconds
)

Parameters

intMilliseconds [in] The amount of time to sleep. (Note: 1000 milliseconds = 1 second)

Return value
None.

Remarks
None.

Example
To sleep for 2 seconds:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.Sleep 2000


BlockInput

Will prevent any user input via the mouse or keyboard. See the Remarks section for limitations.
BlockInput(
    strToggle
)

Parameters

strToggle [in] This should set to the string "on" to block input, and "off" to enable input.

Return value
None.

Remarks
This function will have different effects depending on the operating system used:.

Operating System | "BlockInput" Results
Windows 95 | No effect.
Windows 98 | User input is blocked but AutoIt is also unable to simulate input.
Windows NT 4 (Without ServicePack 6) | No effect.
Windows NT 4 (With ServicePack 6) | User input is blocked and AutoIt can simulate input.
Windows 2000 | User input is blocked and AutoIt can simulate input.

Example
 To Block all user input:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.BlockInput "on"


LeftClick

Simulates a mouse left-click at a given coordinate.
LeftClick(
    intX,
    intY
)

Parameters

intX | [in] X coordinate
intY | [in] Y coordinate

Return value
None.

Remarks
The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window. To perform a double-click, simply run the command twice :)

Example
Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.LeftClick 50, 100

See also
LeftClickDrag, RightClick, RightClickDrag


LeftClickDrag

Simulates a mouse left-click-drag operation.
LeftClickDrag(
    intX1,
    intY1,
    intX2,
    intY2,
)

Parameters

intX1 | [in] X1 coordinate (from coordinate)
intY1 | [in] Y1 coordinate (from coordinate)
intX2 | [in] X2 coordinate (to coordinate)
intY2 | [in] Y2 coordinate (to coordinate)

Return value
None.

Remarks
The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.

Example
Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.LeftClickDrag 50, 100, 200, 200

See also
LeftClick, LeftClickDrag, RightClick, RightClickDrag


MouseGetPosX

Gets the X coordinate of the mouse pointer..
intResult = MouseGetPosX()

Parameters
None.

Return value
The X coordinate of the mouse pointer.

Remarks
The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.

Example
Set oAutoIt = CreateObject("AutoItX.Control")
intXPos = MouseGetPosX()
intYPos = MouseGetPosY()

See also
MouseMove, MouseGetPosY


MouseGetPosY

Gets the Y coordinate of the mouse pointer.
intResult = MouseGetPosY()

Parameters
None.

Return value
The Y coordinate of the mouse pointer.

Remarks
The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.

Example
Set oAutoIt = CreateObject("AutoItX.Control")
intXPos = MouseGetPosX()
intYPos = MouseGetPosY()

See also
MouseMove, MouseGetPosX


MouseMove

Moves the mouse pointer to the specified coordinates.
MouseMove(
    intX,
    intY
)

Parameters

intX | [in] X coordinate
intY | [in] Y coordinate

Return value
None.

Remarks
The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.

Example
To move the mouse to 10,100:

Set oAutoIt = CreateObject("AutoItX.Control")
MouseMove 10, 100

See also
MouseGetPosX, MouseGetPosY


RightClick

Simulates a mouse right-click at a given coordinate.
RightClick(
    intX,
    intY
)

Parameters

intX | [in] X coordinate
intY | [in] Y coordinate

Return value
None.

Remarks
The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window. To perform a double-click, simply run the command twice :)

See also
LeftClick, LeftClickDrag, RightClickDrag


RightClickDrag

Simulates a mouse right-click-drag operation.
RightClickDrag(
    intX1,
    intY1,
    intX2,
    intY2,
)

Parameters

intX1 | [in] X1 coordinate (from coordinate)
intY1 | [in] Y1 coordinate (from coordinate)
intX2 | [in] X2 coordinate (to coordinate)
intY2 | [in] Y2 coordinate (to coordinate)

Return value
None.

Remarks
The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.

See also
LeftClick, LeftClickDrag, RightClick


Send

Sends keystrokes to the currently active window.
Send(
    strLine
)

Parameters

strLine [in] A string containing the set of keystrokes to send.

Return value
None.

Remarks
See here for the syntax of the send command.

Example
To send the keystrokes "Hello, this is a line of text" to the currently active window:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.Send "Hello, this is a line of text"

See also
Send command syntax.


SetCapslockState

This command will correctly set the state of the CAPSLOCK key to either on or off.
SetCapslockState(
    strToggle
)

Parameters

strToggle [in] This should be a string set to "on" to set capslock to ON, and "off" to set capslock to OFF.

Return value
None.

Remarks
None.

Example
To turn on capslock:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.SetCapslockState "on"

See also
SetStoreCapslockMode


SetKeyDelay

This functions will alter the amount of time that AutoIt pauses between each simulated keypress.
SetKeyDelay(
    intDelay
)

Parameters

intDelay [in] The value in milliseconds pause between each simulated keypress. (Default 20ms).

Return value
None.

Remarks
None.

Example
To set the keydelay to 50ms::

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.SetKeyDelay 50


SetStoreCapslockMode

By default, at the start of a "Send" command AutoIt will store the state of the CAPSLOCK key; at the end of the "Send" command this status will be restored. Use this command to turn off this behaviour.
SetStoreCapslockMode(
    strToggle
)

Parameters

strToggle [in] This should be a string set to "on" to store/restore the capslock at the start/end of a send command, and "off" to ignore capslock state. (Default is "on").

Return value
None.

Remarks
None.

Example
To prevent AutoIt from modifying the state of the CAPSLOCK key during "Send" commands:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.SetStoreCapslockMode "off"

See also
SetCapslockState


DetectHiddenText

Some programs use hidden text on windows this can cause problems when trying to script them. This command allows you to tell AutoIt whether or not to detect this hidden text.
DetectHiddenText(
    strToggle
)

Parameters

strToggle [in] This should be a string set to "on" to enable hidden text detection, and "off" to disable. (Default is "off")

Return value
None.

Remarks
When you use the "/reveal" mode of the full AutoIt product, you will see all text, including hidden text.

 Example

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.DetectHiddenText "ON"


IfWinActive

Checks if a given window is currently active.
intResult = IfWinActive(
    strTitle,
    strText
)

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
Returns 1 if the given window was active, otherwise it returns 0.

Remarks
None.

Example
To see the "notepad" window is active:

Set oAutoIt = CreateObject("AutoItX.Control")
nActive = oAutoIt.IfWinActive ("Untitled - Notepad", "")

See also
IfWinExist


IfWinExist

Checks if a given window current exists (in any state).
intResult = IfWinExist(
    strTitle,
    strText
)

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
Returns 1 if the given window exists (regardless of its state), otherwise it returns 0.

Remarks
None.

Example
To see the "notepad" window exists:

Set oAutoIt = CreateObject("AutoItX.Control")
nActive = oAutoIt.IfWinExist ("Untitled - Notepad", "")

See also
IfWinActive


SetTitleMatchMode

This function will alter the way that AutoIt matches window titles in functions such as WinWait, IfWinActive, etc.
SetTitleMatchMode(
    intMode
)

Parameters

intMode [in] The mode of title matching to use -- see the remarks. Valid modes are 1 and 2. (Default is 1).

Return value
None.

Remarks

mode 1
In the szTitle string you specify the start of a window title to match. i.e. for the notepad.exe window (Untitled - Notepad), valid matches would be:
"Untitled", "Untitled -", "Unt" and "Untitled - Notepad".

mode 2
In the szTitle string you can specify ANY substring of the window title you want to match. Again for the notepad.exe window valid matches would be:
"Untitled", "Untitled - Notepad", "Notepad", "No".

Example
Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.SetTitleMatchMode 2


SetWinDelay

This functions will alter the amount of time that AutoIt pauses after performing a WinWait-type function.
SetWinDelay(
    intDelay
)

Parameters

intDelay [in] The value in milliseconds pause after a WinWait-related function. (Default 500ms).

Return value
None.

Remarks
None.

Example
To see the windelay to 1000ms:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.SetWinDelay 2000


WinActivate

This function will activate a specified window.
WinActivate(
    strTitle,
    strText
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
None.

Remarks
None.

Example
To activate the notepad window (titled: "Untitled - Notepad"):

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinActivate "Untitled - Notepad", ""

See also
WinClose, WinHide, WinKill, WinMaximize, WinMinimize, WinMinimizeAll, WinMinimizeAllUndo, WinRestore, WinShow


WinClose

This function will close a specified window.
WinClose(
    strTitle,
    strText
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
None.

Remarks
None.

Example
To close the notepad window (titled: "Untitled - Notepad"):

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinClose "Untitled - Notepad", ""

See also
WinActivate, WinHide, WinKill, WinMaximize, WinMinimize, WinMinimizeAll, WinMinimizeAllUndo, WinRestore, WinShow


WinGetActiveTitle

This function will return the title of the current active window.
strResult = WinGetActiveTitle()

Parameters

Return value
A string containing the title of the currently active window..

Remarks
A maximum of 16384 characters of text can be received; ensure that the text buffer you pass is at least this large.

See also
WinSetTitle


WinHide

This function will hide a specified window.
WinHide(
    strTitle,
    strText
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
None.

Remarks
None.

Example
To hide the notepad window (titled: "Untitled - Notepad"):

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinHide "Untitled - Notepad", ""

See also
WinActivate, WinClose, WinKill, WinMaximize, WinMinimize, WinMinimizeAll, WinMinimizeAllUndo, WinRestore, WinShow


WinKill

This function will forcibly close a specified window.
WinKill(
    strTitle,
    strText
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
None.

Remarks
None.

Example
To kill the notepad window (titled: "Untitled - Notepad"):

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinKill "Untitled - Notepad", ""

See also
WinActivate, WinClose, WinHide, WinMaximize, WinMinimize, WinMinimizeAll, WinMinimizeAllUndo, WinRestore, WinShow


WinMaximize

This function will maximize a specified window.
WinMaximize(
    strTitle,
    strText
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
None.

Remarks
None.

Example
To maximize the notepad window (titled: "Untitled - Notepad"):

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinMaximize "Untitled - Notepad", ""

See also
WinActivate, WinClose, WinHide, WinKill, WinMinimize, WinMinimizeAll, WinMinimizeAllUndo, WinRestore, WinShow


WinMinimize

This function will minimize a specified window.
WinMinimize(
    strTitle,
    strText
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
None.

Remarks
None.

Example
To minimize the notepad window (titled: "Untitled - Notepad"):

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinMinimize "Untitled - Notepad", ""

See also
WinActivate, WinClose, WinHide, WinKill, WinMaximize, WinMinimizeAll, WinMinimizeAllUndo, WinRestore, WinShow


WinMinimizeAll

This function will minimize all windows.
WinMinimizeAll()

Parameters
None.

Return value
None.

Remarks
None.

See also
WinActivate, WinClose, WinHide, WinKill, WinMaximize, WinMinimize, WinMinimizeAllUndo, WinRestore, WinShow


WinMinimizeAllUndo

This function will undo a previous WinMinimizeAll call.
WinMinimizeAllUndo()

Parameters
None.

Return value
None.

Remarks
None.

See also
WinActivate, WinClose, WinHide, WinKill, WinMaximize, WinMinimize, WinMinimizeAll, WinRestore, WinShow


WinMove

Use this function to move/resize a specified window.
WinMove(
    strTitle,
    strText,
    intX,
    intY,
    intWidth,
    intHeight
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.
intX | [in] X coordinate (to coordinate)
intY | [in] Y coordinate (to coordinate)
intWidth | [in] New width of the window. (Use -1 to leave size alone)
intHeight | [in] New height of the window. (Use -1 to leave size alone)

Return value
None.

Remarks
None.


WinRestore

This function will restore a window from a minimized state.
WinRestore(
    strTitle,
    strText
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
None.

Remarks
None.

Example
To restore the notepad window (titled: "Untitled - Notepad"):

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinRestore "Untitled - Notepad", ""

See also
WinActivate, WinClose, WinHide, WinKill, WinMaximize, WinMinimize, WinMinimizeAll, WinMinimizeAllUndo, WinShow


WinSetTitle

Changes the title of a specified window.
WinSetTitle(
    strTitle,
    strText,
    strNewTitle
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.
strNewTitle | [in] A string containing the text of the new window title.

Return value
None.

Remarks
None.

See also
WinGetActiveTitle


WinShow

This function will show a specified window previously hidden.
WinShow(
    strTitle,
    strText
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.

Return value
None.

Remarks
None.

Example
To unhide the notepad window (titled: "Untitled - Notepad"):

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinShow "Untitled - Notepad", ""

See also
WinActivate, WinClose, WinHide, WinKill, WinMaximize, WinMinimize, WinMinimizeAll, WinMinimizeAllUndo, WinRestore


WinWait

This function will pause until the specified window exists (or the function times out).
intResult = WinWait(
    strTitle,
    strText,
    [nTimeout]
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.
intTimeout | [in] Specifies the number of seconds to wait for. Use the value 0 to wait indefinitely.

Return value
Returns 1 if the the intTimeout waiting period was exceeded, otherwise it returns 0.

Remarks
None.

Example
To wait a maximum of 5 seconds for the notepad window (titled: "Untitled - Notepad") to exist:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinWait "Untitled - Notepad", "", 5

See also
WinWaitActive, WinWaitClose, WinWaitNotActive


WinWaitActive

This function will pause until the specified window is active (or the function times out).
intResult = WinWaitActive(
    strTitle,
    strText,
    [nTimeout]
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.
intTimeout | [in] Specifies the number of seconds to wait for. Use the value 0 to wait indefinitely.

Return value
Returns 1 if the the intTimeout waiting period was exceeded, otherwise it returns 0.

Remarks
None.

Example
To wait indefinitely for the notepad window (titled: "Untitled - Notepad") to be active:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinWaitActive "Untitled - Notepad", "", 0

Or:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinWaitActive "Untitled - Notepad", ""

See also
WinWait, WinWaitClose, WinWaitNotActive


WinWaitNotActive

This function will pause until the specified window is not active (or the function times out).
intResult = WinWaitNotActive(
    strTitle,
    strText,
    [nTimeout]
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.
intTimeout | [in] Specifies the number of seconds to wait for. Use the value 0 to wait indefinitely.

Return value
Returns 1 if the the intTimeout waiting period was exceeded, otherwise it returns 0.

Remarks
None.

Example
To wait indefinitely for the notepad window (titled: "Untitled - Notepad") to be become inactive:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinWaitNotActive "Untitled - Notepad", "", 0

See also
WinWait, WinWaitActive, WinWaitClose


WinWaitClose

This function will pause until the specified window doesn't exist (or the function times out).
intResult = WinWaitClose(
    strTitle,
    strText,
    [nTimeout]
 )

Parameters

strTitle | [in] A string containing the title of the window to match.
strText | [in] A string containing the text of the window to match.
intTimeout | [in] Specifies the number of seconds to wait for. Use the value 0 to wait indefinitely.

Return value
Returns 1 if the the intTimeout waiting period was exceeded, otherwise it returns 0.

Remarks
None.

Example
To wait indefinitely for the notepad window (titled: "Untitled - Notepad") to close/not exist:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.WinWaitClose "Untitled - Notepad", ""

See also
WinWait, WinWaitActive, WinWaitNotActive


IniDelete

Deletes a specified value from a standard .INI file.
IniDelete(
    strFile,
    strSection,
    strValue
 )

Parameters

strFile | [in] A string containing the filename of the .INI file.
strSection | [in] A string containing the required section of the .INI file.
strValue | [in] A string containing the value to delete.

Return value
None.

Remarks
An INI file is taken to be a file of the following format:

[SectionName]
Value=Result

The full path of the INI file must be given, however, it is acceptable to use something similar to ".\myfile.ini" to indicate a file in the current working directory.

See also
IniRead, IniWrite


IniRead

Reads a specified value from a standard .INI file.
strResult = IniRead(
    strFile,
    strSection,
    strValue
 )

Parameters

strFile | [in] A string containing the filename of the .INI file.
strSection | [in] A string containing the required section of the .INI file.
strValue | [in] A string containing the value to read.

Return value
A string containing the value read.

Remarks
An INI file is taken to be a file of the following format:

[SectionName]
Value=Result

The full path of the INI file must be given, however, it is acceptable to use something similar to ".\myfile.ini" to indicate a file in the current working directory.

Example
To read a value from an INI file:

Set oAutoIt = CreateObject("AutoItX.Control")
strResult = oAutoIt.IniRead ("c:\path\file.ini", "mysection", "myvalue")

See also
IniDelete, IniWrite


IniWrite

Write a specified value to a standard .INI file.
IniWrite(
    strFile,
    strSection,
    strValue,
    strResult
)

Parameters

strFile | [in] A string containing the filename of the .INI file.
strSection | [in] A string containing the required section of the .INI file.
strValue | [in] A string containing the value to write to.
strResult | [in] A string containing result to write.

Return value
None.

Remarks
An INI file is taken to be a file of the following format:

[SectionName]
Value=Result

The full path of the INI file must be given, however, it is acceptable to use something similar to ".\myfile.ini" to indicate a file in the current working directory.

See also
IniDelete, IniRead


ClipGet

Allows you to get text from the clipboard.
strText = ClipGet()

Parameters
None.

Return value
A string containing text from the clipboard.

Remarks
A maximum of 16384 characters of text can be received.

Example
To get some text from the clipboard:

Set oAutoIt = CreateObject("AutoItX.Control")
Text = oAutoIt.ClipGet()

See also
ClipPut


ClipPut

Allows you to send text to the clipboard.
ClipPut(
    strText
)

Parameters

strText [in] A string that contains the text you want to send.

Return value
None.

Remarks
A maximum of 16384 characters of text can be sent.

Example
To send some text to the clipboard:

Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.ClipPut "Paste Me!"

See also
ClipGet


History

17/12/2002 - v1.51

  • More Windows keys options added to the Send command: LWINDOWN, RWINDOWN.
  • Internal optimisations and modularisation.

04/02/2002 - v1.50

  • Really quite nice API documentation finished.
  • WinWait-type timeouts should now be 100% accurate.
  • WinActivate improved under 2000/XP (hopefully!).
  • Added default size option for WinMove.

26/08/2001 - v1.40

  • Added methods: SetCapslockState, SetStoreCapslockMode, IniDelete, WinMinimizeAllUndo, BlockInput.
  • Clipboard buffer increased to 16k.
  • Improved "SendKeys" routines implemented from AutoIt v2.61.

20/12/99 - v1.32

  • Internal changes and optimizations.

10/12/99 - v1.3

  • MouseGetPosX and MouseGetPosY methods added.
  • MouseMove method added.
  • Bugs with sending keystrokes to DOS fixed.

25/11/99 - v1.23

  • WinActivate tweaked for Win2000 RC2.
  • Shutdown command added.
  • WinKill command added.

23/11/99 - v1.22

  • Simple clipboard commands added.
  • INI file commands added.

20/11/99 - v1.21

  • Can now Send decimal ASCII codes, like when using using the ALT key and the numeric keypad (e.g. ALT+65 = 'A'). Very useful for sending characters that don't usually work (e.g. '~' on an Italian keyboard).

18/11/99 - v1.2

  • Added methods IfWinActive, IfWinExist and WinShow
  • Added timeout functionality to the WinWait group of methods

11/09/99 - v1.1

  • Fixed "processor hog" bug in WinWaitActive.
  • Added keys {CTRLUP}, {CTRLDOWN}, {SHIFTUP}, {SHIFTDOWN}, {ALTUP}, {ALTDOWN}.

28/08/99 - v1.01

  • Added methods LeftClickDrag and RightClickDrag.

19/08/99 - v1.0

  • First version